<?php
class eBayGetUserFeedback extends gravy{
	public $username="";
	public $token="";
	public $dsr=array();
	public $xml="";

	function __construct($username="", $token=""){
		parent::__construct();
		$this->username=$username;
		$this->token=$token;
	}

	public function get(){
		$result=false;

		if(strlen($this->username)>0 && strlen($this->token)>0){
			$requestXml='<?xml version="1.0" encoding="utf-8"?>';
			$requestXml.='<GetFeedbackRequest xmlns="urn:ebay:apis:eBLBaseComponents">';
			$requestXml.='	<RequesterCredentials>';
			$requestXml.='		<eBayAuthToken>'.$this->token.'</eBayAuthToken> ';
			$requestXml.='	</RequesterCredentials>';
			$requestXml.='	<UserID>'.$this->username.'</UserID>';
			$requestXml.='</GetFeedbackRequest>';

			$req=new eBayRequest("GetFeedback");
			if($this->xml=$req->fetch($requestXml)){
				$this->dsr=array();
				for($c=0;$c<count($this->xml->FeedbackSummary->SellerAverageRatingDetailArray->AverageRatingDetails);$c++){
					$item=$this->xml->FeedbackSummary->SellerAverageRatingDetailArray->AverageRatingDetails[$c];
					$this->dsr[(string)$item->RatingDetail]=(string)$item->Rating;
				}
				$result=true;
			}
		}
		return($result);
	}
}
?>